package ar.uade.edu.fain.ad.server.dao.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "tipo", discriminatorType = DiscriminatorType.STRING)
@Table(name = "EMPLEADO")
@NamedQueries({
	@NamedQuery(name = "empleado.byCredenciales", query = 
			"	SELECT e "
			+ "	FROM EmpleadoEntity e"
			+ "	WHERE e.login = :login AND e.password = :pass")
})
public class EmpleadoEntity {

	@Id
	private Long id;

	@Column
	private String nombre;

	@Column
	private String apellido;

	@Column
	private String login;

	@Column
	private String password;

	@OneToMany(mappedBy = "empleado")
	private List<IngresoUsuarioEntity> ingresos;

	@ManyToOne
	@JoinColumn(name = "idArea")
	private AreaEntity area;

	public EmpleadoEntity() {
		super();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public String getApellido() {
		return apellido;
	}

	public void setApellido(String apellido) {
		this.apellido = apellido;
	}

	public void setArea(AreaEntity area) {
		this.area = area;
	}

	public AreaEntity getArea() {
		return area;
	}

	public void setIngresos(List<IngresoUsuarioEntity> ingresos) {
		this.ingresos = ingresos;
	}

	public List<IngresoUsuarioEntity> getIngresos() {
		return ingresos;
	}

}
